import java.util.*;
import java.text.*;


public class stringtodatetime {
 public static void main(String[] args) {
 try {  String str_date="21-09-2012 16:12:15";
 DateFormat formatter ; 
 Date date ; 
  formatter = new SimpleDateFormat("dd-mm-yyyy HH:mm:ss");
  date = (Date)formatter.parse(str_date);  
 System.out.println(date );
  } catch (ParseException e)
  {System.out.println("Exception :"+e);  }  
 
 }
}